package com.service.bean.alarm;

import java.lang.reflect.Method;

import com.service.bean.Road_GpsSignal;
import com.service.bean.Road_MixingSignal;
import com.service.bean.Road_Vehicle;

public class RoadAlarmRule {
	public String ruleId;
	/**
	 * 规则名称
	 */
	public String RuleName;
	/**
	 * 报警类型
	 */
	public String AlarmType;
	/**
	 * 配比序号
	 */
	public String FormulaId;
	/**
	 * 配比号
	 */
	public int FormulaNo;
	/**
	 * 配比名称
	 */
	public String FormulaName;
	/**
	 * 报警等级
	 */
	public String AlarmLevel;
	/**
	 * 报警参数1
	 */
	public String Value1;
	/**
	 * 报警参数2
	 */
	public String Value2;
	
	
	@SuppressWarnings("unchecked")
	public RoadAlarmInfo doRoadAlarm(Road_Vehicle vehicle,Road_GpsSignal bean){
		RoadAlarmInfo ai = null;
		try {
			@SuppressWarnings("rawtypes")
			Class fileClass = Class.forName("com.service.alarm.RoadAlarmFunction");
			Method method = fileClass.getDeclaredMethod("alarm" + this.AlarmType, vehicle.getClass(),bean.getClass(),this.getClass());
			ai = (RoadAlarmInfo) method.invoke(fileClass.newInstance(),vehicle,bean,this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ai;
	}
	@SuppressWarnings("unchecked")
	public RoadAlarmInfo doMiXingAlarm(Road_Vehicle vehicle, Road_MixingSignal bean){
		RoadAlarmInfo ai = null;
		try {
			@SuppressWarnings("rawtypes")
			Class fileClass = Class.forName("com.service.alarm.RoadAlarmFunction");
			Method method = fileClass.getDeclaredMethod("alarm" + AlarmType, vehicle.getClass(),bean.getClass(),this.getClass());
			ai = (RoadAlarmInfo) method.invoke(fileClass.newInstance(),vehicle,bean,this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ai;
	}
}
